package com.fire.control.system.module.index.controller.app;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.fire.control.system.module.common.controller.BaseController;
import com.fire.control.system.module.index.service.AppIndexService;
import com.fire.control.system.standard.BusinessInterfaceStandard;
import com.fire.control.system.support.protocol.app.AppRequestProtocol;
import com.fire.control.system.support.protocol.comman.ResponseProtocol;

/**
 * 
 * @ClassName:  AppIndexController
 * @Description:  首页控制器
 * @author:  xiechengguang
 * @date:  2017年6月1日 下午5:55:26
 *
 */
@Controller
@RequestMapping(value = "/app/index")
public class AppIndexController extends BaseController implements BusinessInterfaceStandard<AppRequestProtocol,ResponseProtocol> {
	private static final Logger logger = LoggerFactory.getLogger(AppIndexController.class);
	@Autowired
	private AppIndexService indexService;
	
	/**
	 * 
	 * @Title: index   
	 * @Description: 获取首页数据  
	 * @param:        
	 * @return: ResponseJsonProtocol      
	 * @throws
	 */
	@RequestMapping(value = "/index", method = RequestMethod.POST)
	@ResponseBody
	public ResponseProtocol index(@RequestBody AppRequestProtocol requestProtocol){
		logger.info("index (" + requestProtocol.getTaskuuid() + ") task In time: "+System.currentTimeMillis());
		
		ResponseProtocol response = indexService.initData(requestProtocol,getUser());
		
		logger.info("index (" + requestProtocol.getTaskuuid() + ") task Out time: "+System.currentTimeMillis());
		return response;
	}
}
